package com.jxtti.service;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jxtti.dao.SysTypeIDDao;
import com.jxtti.entity.Sys_TypeID;

@Service("SysTypeIDService")
@Transactional(rollbackFor = { RuntimeException.class, Exception.class })
public class SysTypeIDService {
	private final static Logger log= Logger.getLogger(SysTypeIDService.class);	

	@Autowired
    private SysTypeIDDao<Sys_TypeID> sysTypeIDDao;
	
    /**
	 * 获取信息数据列表-----分页 
	 * 
	 * @param data
	 * @return
	 */
	public  PageInfo<Sys_TypeID> list(Map<String, Object> data)
	{	
		// 第几页
		int pageNum = Integer.parseInt((data.get("page") == null || data.get("page").equals("0")) ? "1" : data.get("page").toString());
		// 每页显示条数 
		int pageSize = Integer.parseInt((data.get("rows") == null || data.get("rows").equals("0")) ? "10" : data.get("rows").toString());
			
		PageHelper.startPage(pageNum, pageSize);
		PageInfo<Sys_TypeID> pages = new PageInfo<Sys_TypeID>(sysTypeIDDao.queryByList(data));		
		return pages;
	}
	
	
	public List<Sys_TypeID>  queryAll(Map<String, Object> data)
	{
		return  sysTypeIDDao.queryByList(data);
	}		
	
	public int add(Sys_TypeID entity)
	{
		int insertCount = sysTypeIDDao.add(entity);
		return insertCount;
	}	
	
	public int update(Sys_TypeID entity)
	{
		int updateCount = sysTypeIDDao.update(entity);
		return updateCount;
	}	
	
	public int delete(Sys_TypeID entity)
	{
		int deleteCount = sysTypeIDDao.delete(entity);		
		return deleteCount;
	}	

	public Sys_TypeID queryListById(Sys_TypeID entity)
	{
		entity = sysTypeIDDao.queryListById(entity);
		return entity;
	}
}
